package com.tree.validationdemo.controller;

import com.tree.validationdemo.entity.User;
import com.tree.validationdemo.group.Create;
import com.tree.validationdemo.group.Update;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author zhong
 * @version 1
 * @date 2022/04/10
 * @contact 1478168700@qq.com
 **/
@RestController
@RequestMapping("/test")
public class GroupTestController {

    @PostMapping("/save")
    public String save(@Validated(value = {Create.class}) @RequestBody User user) {
        return "save";
    }

    @PostMapping("/update")
    public String update(@Validated(value = {Update.class}) @RequestBody User user) {
        return "update";
    }
}
